﻿using Common.Communal;
using ERP.Domain.Warehouse;
using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Warehouse.Repository;
using Warehouse.Services.IServices;

namespace Warehouse.Services.Services
{
    public class InventoryTransactionService : IInventoryTransactionService
    {
        private readonly IInventoryTransactionRepository inventoryTransactionRepository;

        public InventoryTransactionService(IInventoryTransactionRepository inventoryTransactionRepository)
        {
            this.inventoryTransactionRepository = inventoryTransactionRepository;
        }
        public async Task<ApiResult<int>> InventoryTransactionAdd(InventoryTransaction inventoryTransaction)
        {
            ApiResult<int> result = new ApiResult<int>();
            result.Code= EnumCode.Ok;
            result.Message= "出库或入库成功";
            var list = await inventoryTransactionRepository.AddAsync(inventoryTransaction);
            result.Data = list;
            return await Task.FromResult(result);

        }
    }
}
